#!/bin/bash

echo "🚀 Building Complete Smart AI Agent System..."
echo "=============================================="

WXWIN="/d/vc/wxWidgets-3.2.7"

# 检查必要的源文件
echo "📋 Checking source files..."
REQUIRED_FILES=(
    "src/main.cpp"
    "src/ai_agent.h"
    "src/ai_agent.cpp"
    "src/agents.h"
    "src/agents.cpp"
    "src/modern_chat_app.h"
    "src/modern_chat_app.cpp"
)

for file in "${REQUIRED_FILES[@]}"; do
    if [ ! -f "$file" ]; then
        echo "❌ $file not found!"
        exit 1
    fi
done

echo "✅ All source files present"

# 构建命令
echo "🔨 Building AI Agent System..."
g++ -std=c++17 -O2 
    -I"$WXWIN/include" \
    -I"$WXWIN/lib/wx/include/msw-unicode-3.2" \
-I"$WXWIN/lib/gcc_dll/mswu" -I"src" \
    src/main.cpp \
    src/ai_agent.cpp \
    src/agents.cpp \
    src/modern_chat_app.cpp \
    -L"$WXWIN/lib/gcc_dll" \
    -lwx_mswu_xrc-3.2 \
    -lwx_mswu_html-3.2 \
    -lwx_mswu_qa-3.2 \
    -lwx_mswu_adv-3.2 \
    -lwx_mswu_core-3.2 \
    -lwx_baseu_xml-3.2 \
    -lwx_baseu_net-3.2 \
    -lwx_baseu-3.2 \
    -lwxscintilla-3.2 \
    -mwindows -lopengl32 -lglu32 \
    -o modern_ai_chat_complete.exe

if [ $? -eq 0 ]; then
    echo "✅ Build successful! Output: modern_ai_chat_complete.exe"
    echo ""
    echo "🎉 AI智能体系统构建完成！"
    echo ""
    echo "🚀 运行方式:"
    echo "   ./modern_ai_chat_complete.exe"
    echo ""
    echo "💡 功能特色:"
    echo "   • 💬 智能对话助手 - 类似DeepSeek"
    echo "   • 🔧 代码生成器 - 多种编程语言"
    echo "   • 🔍 代码分析器 - 项目结构分析"
    echo ""
    echo "🛠️ 支持MCP服务器和AGI编码功能"
else
    echo "❌ Build failed"
    exit 1
fi
